<div id="login_form-<?php echo $this->params->id; ?>" class="login_form<?php echo $this->css_suffix;?>">
	<form method="POST" action="javascript:login_form_<?php echo $this->params->id; ?>_try_login();">	
		<fieldset>
			<legend>Login form</legend>
			
			<p>
				<label for="username">User</label> <input class="text" type="text" id="login_form-<?php echo $this->params->id; ?>-username" name="username" value="<?php echo $this->user; ?>" />
			</p>
			
			<p>
				<label for="password">Password</label> <input class="text" type="password" id="login_form-<?php echo $this->params->id; ?>-password" name="password"/>
			</p>
			
			<p>
				<input class="checkbox" type="checkbox" id="login_form-<?php echo $this->params->id; ?>-remember" name="remember" /> Remember me
			</p>
			
			<div id="login_form-<?php echo $this->params->id; ?>-message" style="display:none">
			
			</div>
			
			<p class="submit">
				<input type="submit" value="Log in" />
				
				<div id="login_form-<?php echo $this->params->id; ?>-result" style="position: relative; width: 50px;">
					
				</div>
			</p>
			
		</fieldset>
	</form>
</div>

<script type="text/javascript">
	
	form_ok = true;
	
	function login_form_<?php echo $this->params->id; ?>_try_login()
	{
		if (form_ok)
		{
			JQ("#login_form-<?php echo $this->params->id; ?>-result").html('<img src="ext/php-puzzle-html-components/rsc/img/spinner1.gif" alt="..." />');
			JQ("#login_form-<?php echo $this->params->id; ?>-result").show();
			
			username = JQ("#login_form-<?php echo $this->params->id; ?>-username").val();
			password = JQ("#login_form-<?php echo $this->params->id; ?>-password").val();
			url = puzzle["base_url"] + "index.php?extension=php-puzzle-directory&exec=login"; // default controllers/views showing!!
			url += "&username=" + username + "&password=" + password;
			
			JQ.get(url, function(data)
			{
				JQ("#login_form-<?php echo $this->params->id; ?>-result").text("Data Loaded: " + data);
			});
			//JQ("#").trigger("login", true);
		}
	}
	
</script>
